<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta id="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
		<meta name="apple-themes-web-app-capable" content="yes">
		<meta content="yes" name="apple-mobile-web-app-capable">
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<meta content="telephone=no" name="format-detection">
		<meta content="email=no" name="format-detection">
		<meta name="format-detection" content="telephone=no">
		<title>兑换奖品</title>	
		<link rel="stylesheet" href="${s.base}/mobile/css/main.css" type="text/css" media="all">
	</head>

	<body>   
		<header id="header">
			<div class="header_con">
				<a href="javascript:history.go(-1);"><span></span></a> 
                <div class="top_tit">兑换奖品</div>         
			</div>
		</header>
<style type="text/css">
			.font1{color:#F00;}
			
			.xy_list{width:100%; background-color:#FFF;}
			.xy_list .content{width:100%;}
			.xy_list .content li{width:100%; padding:0px; height:0.66rem;}
			.xy_list .content li .c_left{width:20%; float:left;line-height: 0.66rem;color: #333;font-size: 0.22rem; text-align:center; }
			.xy_list .content li .c_left_1{width:30%; float:left;line-height: 0.66rem;color: #333;font-size: 0.22rem; text-align:center; }
			.xy_list .content li .c_center{width:30%; float:left;line-height: 0.66rem;color: #333;font-size: 0.2rem; text-align:center;}
			.xy_list .content li .c_right{width:20%; float:left;line-height: 0.66rem;color: #333;font-size: 0.22rem; text-align:center; }
			
        </style>
		<div id="content_div" >
            <div class="wq_list">
              <ul>
              <li style="border:0px;">
               <i style="background: url(${item.imageOne}) no-repeat;background-size: 0.56rem 0.56rem;"></i>
               <p style="padding:0px; font-size: 0.28rem;color: #333;line-height: 0.38rem; margin-bottom:0.1rem;">${item.title}</p>
               <p style="padding-left: 1rem;"><span style="width: 2rem;">中奖号码：</span>  <em>${winningNum}</em></p>
              </li>
              </ul>
            </div>
             <div class="pay_02">
              <p class="border_bottom">领奖类型 <span>
              	<select style="width: 100%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: right;" id="type" >
						<option value="1">直接领取</option>
						<option value="2">转让</option>
					</select>
              </span></p>
             </div>

			<div class="pay_02 duihuan" <#if item.type?if_exists&&item.type=='1'>style="display: none"</#if>>
				<p class="border_bottom"> 兑换码
			  	<span>
				  <input type="text" id="redeemCode" name="redeemCode" value="${item.redeemCode}" style="width: 100%;height: 0.8rem;line-height: 0.8rem;margin-bottom:2px;border: 0px; text-align: right;" />
			  	</span>
				</p>
			</div>

             <div class="pay_02 shouhuo" <#if item.type?if_exists&&item.type=='2'>style="display: none"</#if>>
              <p class="border_bottom"> 收货人
			  	<span>
				  <input type="text" id="name" name="name" value="${address.name}" style="width: 100%;height: 0.8rem;line-height: 0.8rem;margin-bottom:2px;border: 0px; text-align: right;" placeholder="请输入收货人" />
			  	</span>
			  </p>
              <p class="border_bottom">收货人手机号
				  <span>
					  <input type="text" id="phone" name="phone" value="${address.phone}" style="width: 100%;height: 0.8rem;line-height: 0.8rem;margin-bottom:2px;border: 0px; text-align: right;" placeholder="请输入手机号"/>
				  </span>
			  </p>
              <p class="border_bottom">收货地址
				  <span>
					  <input type="text" id="address" name="address" value="${address.province}${address.city}${address.area}${address.descripts}"
							 style="width: 100%;height: 0.8rem;line-height: 0.8rem;margin-bottom:2px;border: 0px; text-align: right;" placeholder="请输入收货地址" />
				  </span>
			  </p>
             </div>
             <div class="pay_02 zhuanrang"  style="display:none;">
              <p class="border_bottom"> 转让人ID
				  <span>
					  <input type="text" id="otherUser" name="otherUser" style="width: 100%;height: 0.8rem;line-height: 0.8rem;margin-bottom:2px;border: 0px; text-align: right;" placeholder="请输入转让人ID" />
				  </span>
			  </p>
			  <p class="border_bottom"> 转让价格
				 <span>
				  <input type="text" id="transferPrice" name="transferPrice" value="${item.transferPrice}" style="width: 100%;height: 0.8rem;line-height: 0.8rem;margin-bottom:2px;border: 0px; text-align: right;" placeholder="请输入转让价格" />
			  	 </span>
			  </p>
				 <p class="border_bottom"> 支付宝账号
					 <span>
				  <input type="text" id="alipay" name="transferPrice" value="${member.alipay}" style="width: 100%;height: 0.8rem;line-height: 0.8rem;margin-bottom:2px;border: 0px; text-align: right;" placeholder="请输入支付宝账号" />
			  	 </span>
				 </p>
				 <p class="border_bottom"> 微信账号
					 <span>
				  <input type="text" id="weChat" name="weChat" value="${member.weChat}" style="width: 100%;height: 0.8rem;line-height: 0.8rem;margin-bottom:2px;border: 0px; text-align: right;" placeholder="请输入微信账号" />
			  	 </span>
				 </p>
             </div>
            <div class="yy_jl_box" id="addressShow" <#if address.id??>style="display:none;"</#if>>
			 <div class="yy_jl_no">
			  <i></i>
			  <p>您还没有填写地址哦！</p>
			  <a onclick="window.location.href='/phone/addressUpdate?memberId=${memberId}&id='">立即填写</a>
			 </div>
             </div>
             
           <div class="pay_04 margin_top_1 lingqu">
			   <a href="javascript:void(0)" class="ui-btn" onclick="updateReceiving();">立即领取</a>
		   </div>
	 
           <div class="pay_04 margin_top_1 zhuanrang" style="display:none;">
			   <a href="javascript:void(0)" class="ui-btn" onclick="updateReceiving();">立即转让</a>
		   </div>
      	</div>	
           
          <script src="${s.base}/mobile/js/jquery-1.7.2.min.js"></script>
		  <script type="text/javascript" src="${s.base}/mobile/js/common.js"></script>
		  <script type="text/javascript" src="${s.base}/js/layer/layer.js"></script>
		  <script type="text/javascript" src="${s.base}/js/base/commont.js"></script>
          <script type="text/javascript">
			  var memberId = '${memberId}';
			  var receivingId = '${receivingId}';
			$("#type").bind("change",function(){
				var type=$("#type").val();
				var itemType = '${item.type}';
				var id = '${address.id}';
				if(type=='1'){
					//直接领取
					$(".zhuanrang").hide();
					if (itemType == '1'){
						$(".shouhuo").show();
						$(".lingqu").show();
					}
					if (itemType == '2'){
						$(".duihuan").show();
						$(".lingqu").show();
					}

					if (id != ""){
						$("#addressShow").hide();
					} else {
						$("#addressShow").show();
					}
				}else{
					$(".lingqu").hide();
					$(".zhuanrang").show();
					$("#addressShow").hide();
				}
			});

			  function updateReceiving() {
				  var type=$("#type").val();
				  var param={};
				  if(type=='1'){
					  //直接领取
					  var phone = $("#phone").val();
					  var name = $("#name").val();
					  var address = $("#address").val();
					  var redeemCode = $("#redeemCode").val();
					  param={id:receivingId,type:type,phone:phone,name:name,address:address,redeemCode:redeemCode};
				  }else{
					  var otherUser = $("#otherUser").val();
                      var transferPrice = $("#transferPrice").val();
                      var alipay = $("#alipay").val();
                      var weChat = $("#weChat").val();
					  param={id:receivingId,type:type,otherUser:otherUser,transferPrice:transferPrice,alipay:alipay,weChat:weChat};
				  }

				  $.post("/receiving/updateOrAddEntity",param,function(result){
					  if(1==result.returnInfo.state){
						  // showLayerAlertNoRefre("操作成功！");
						  window.location.href="/phone/myWinRecord?memberId="+memberId;
					  }else{
						  showLayerAlertNoRefre(result.returnInfo.errorMsg);
					  }
				  },"json");
				  return false;
			  }


          </script>
	</body>

</html>